namespace PickGold.Charting
{
    using System;
    using System.ComponentModel;
    using System.Globalization;

    internal class AnnotationAxisValueConverter : TypeConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (value == null)
                {
                    return "NotSet";
                }
                Axis axis = value as Axis;
                if ((axis != null) && (axis.ChartArea != null))
                {
                    return (axis.ChartArea.Name + " - " + axis.Name);
                }
            }
            return base.ConvertTo(context, culture, value, destinationType);
        }
    }
}

